package org.edu.modules.oa.controller;

import com.github.xiaoymin.knife4j.annotations.ApiSort;
import groovy.util.logging.Slf4j;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.edu.common.api.vo.Result;
import org.edu.modules.oa.entity.VeOaMeetEntity;
import org.edu.modules.oa.entity.VeOaMeetPlaceEntity;
import org.edu.modules.oa.service.IVeOaMeetManageService;
import org.edu.modules.oa.service.IVeOaMeetPlaceService;
import org.edu.modules.oa.vo.VeOaMeetSelectByIdVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

@Api(tags = "会议管理")
@RestController
@RequestMapping("oa/veOaMeetManage")
@Slf4j
@ApiSort(value = 100)
public class VeOaMeetManageController {

    @Resource
    private IVeOaMeetManageService veOaMeetManageService;
    @Resource
    private IVeOaMeetPlaceService veOaMeetPlaceService;

    @PostMapping("/loadMeet")
    @ApiOperation(value="显示表格", notes="会议管理-显示表格")
    public Result<?> loadMeet(Integer current, Integer pageSize, VeOaMeetEntity veOaMeetEntity){
        int limit = (current-1)*pageSize;
        HashMap<String,Object> map = veOaMeetManageService.loadMeet(limit,pageSize,veOaMeetEntity);
        return Result.OK(map);
    }

    @PostMapping("/loadPlaces")
    @ApiOperation(value="显示场地的下拉框", notes="会议管理-加载下拉框")
    public Result<?> loadPlaces(){
        List<VeOaMeetPlaceEntity> list = veOaMeetPlaceService.selectPlaces();
        return Result.OK(list);
    }

    @PostMapping("/selectMeetById")
    @ApiOperation(value="查看会议详情", notes="会议管理-查看会议详情")
    public Result<?> selectMeetById(Integer id){
        VeOaMeetSelectByIdVo veOaMeetSelectByIdVo = veOaMeetManageService.selectMeetById(id);
        return Result.OK(veOaMeetSelectByIdVo);
    }








}


